﻿using MediatR;
using SystemMHB.API.Application.Command.WarehouseCommand;
using SystemMHB.Domian;
using SystemMHB.Infrstructer.Interface;

namespace SystemMHB.API.Application.CommandHandlers.WarehouseCommandHandler
{
    public class WarehouseFanCommandHandler : IRequestHandler<WarehouseFanCommand, Warehouse>
    {
        /// <summary>
        /// 仓库管理仓储
        /// </summary>
        IWarehouseRepository WarRep;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="WarRep">仓库管理仓储</param>
        public WarehouseFanCommandHandler(IWarehouseRepository WarRep)
        {
            this.WarRep = WarRep;
        }

        public async Task<Warehouse> Handle(WarehouseFanCommand request, CancellationToken cancellationToken)
        {
            return await WarRep.GetModelAsync(request.warehouseID);
        }
    }
}
